#include "cfg.h"
#include "MemoryManagement.h"

namespace EngineLib {

	static void *_memory;

	void MemoryManagement::StartUp(void)
	{
		_memory = malloc(TOTAL_MEMORY);

		MemoryManagement::Root = (MemoryStack*)_memory;
		MemoryManagement::Root->Set(TOTAL_MEMORY);

		MemoryManagement::Common128 = MemoryPool::New(MemoryManagement::Root, COMMON_POOL_COUNT, sizeof(Data128), MemoryStack::RIGHT);
	}

	void MemoryManagement::ShutDown(void)
	{
		MemoryManagement::Root = 0;
		MemoryManagement::Common128 = 0;
		free(_memory);
	}

	MemoryStack *MemoryManagement::Root = 0;
	MemoryPool *MemoryManagement::Common128 = 0;
}